<?php
/**
 * Radcodes - SocialEngine Module
 *
 * @category   Application_Extensions
 * @package    Game
 * @copyright  Copyright (c) 2009-2010 Radcodes LLC (http://www.radcodes.com)
 * @license    http://www.radcodes.com/license/
 * @version    $Id$
 * @author     Vincent Van <vincent@radcodes.com>
 */
?>




<div class="game_profile_flash_player">
  <span>
    <?php echo $this->partial('index/_embed_code.tpl', 'game', array('game' => $this->game, 'max_width' => $this->max_width))?>
  </span>
</div>

<?php if ($this->mochibridge && $this->mochipublisherid): ?>

<?php $this->headScript()->appendFile("http://xs.mochiads.com/static/pub/swf/leaderboard.js"); ?>
<div id="leaderboard_bridge"></div>
<script type="text/javascript">
  var gameFullBaseUrl = window.location.protocol + '//' + window.location.hostname + en4.core.baseUrl;
  var gameFullBasePath = window.location.protocol + '//' + window.location.hostname;

  // Mochi Bridge
  var options = {partnerID: "<?php echo $this->mochipublisherid; ?>", id: "leaderboard_bridge"};

  options.siteName = "<?php echo $this->string()->escapeJavascript($this->layout()->siteinfo['title']) ?>";
<?php if ($this->mochibridgelogo): ?>
  options.logoURL = "<?php echo $this->mochibridgelogo; ?>";
<?php endif; ?>
  options.siteURL = gameFullBaseUrl;
  options.profileURL = gameFullBaseUrl + "profile/${uid}";
  options.sessionID = "<?php echo $this->game->getIdentity(); ?>";

  options.gateway = gameFullBasePath + "<?php echo $this->url(array('controller' => 'bridge', 'action'=>'score'), 'game_extended', true) ?>";
  options.denyFriends = "true";

<?php if ($this->mochibridgedebug): ?>
  options.width = 680;
  options.height = 400;
  options.debug = "true";
<?php endif; ?>

<?php if ($this->viewer()->getIdentity()): ?>
  options.userID = "<?php echo $this->viewer()->getIdentity(); ?>";
  options.username = "<?php echo $this->string()->escapeJavascript($this->viewer()->getTitle()); ?>";
  //options.thumbURL = gameFullBasePath + "<?php echo $this->viewer()->getPhotoUrl('thumb.icon'); ?>";
  //options.thumbURL = gameFullBasePath + "<?php echo $this->url(array('controller' => 'bridge', 'action'=>'profile-photo', 'user_id'=>$this->viewer()->getIdentity()), 'game_extended', true) ?>";
  options.thumbURL = gameFullBaseUrl + "games/bridge/profile-photo/user_id/${uid}";
<?php else: ?>
//optional - display when not logged in
  options.denyScores = "<?php echo $this->string()->escapeJavascript($this->translate('Please login to submit your score!')); ?>";
<?php endif; ?>

//alert('gameFullBaseUrl=' + gameFullBaseUrl);
//alert('gameFullBasePath=' + gameFullBasePath);
//alert('profileURL=' + options.profileURL);
//alert('gateway=' + options.gateway);
//alert('thumbURL=' + options.thumbURL);

// optional
//options.callback = function (params) { alert(params.name + " (" + params.username + ") just scored " + params.score + "!"); }
// uncomment this to display global scores
// options.globalScores = "true";

  Mochi.addLeaderboardIntegration(options);
</script>

<?php endif; //mochibridge ?>

<?php /*
<div id="leaderboard_widget"></div>
<script type="text/javascript">
// Customized example: Embeds a 500x500 leaderboard widget, replacing the "leaderboard_widget" div
var options = {game: "<?php echo $this->game->distributor_ref_slug; ?>", width: 500, height: 500, id: "leaderboard_widget"};
// Select a specific leaderboard for a game - optional (if not included, a selectable list will be used)
//options.leaderboard = "Level 1";
// your publisher ID - optional (if not included, ALL scores from all sites will be shown)
options.partnerID = "<?php echo $this->mochipublisherid; ?>";
// username link prefix - optional
options.profileURL = gameFullBaseUrl + "profile/${id}";
// leaderboard background color - optional
options.backgroundColor = "#ffffff";
// Show the widget!
options.defaultTab = "alltime";
// Default to the all time tab!
Mochi.showLeaderboardWidget(options);
</script>
*/
?>